import requests
import time
import asyncio

from huangG.hg import HG
from huangG.hg_config import HG_Config as config


def get_football_today_detail(lid):
        """获取今日初盘的足球数据"""
        # 获取当前时间戳（毫秒）
        config.football_today_detail_request['ts'] = str(int(time.time() * 1000))
        config.football_today_detail_request['uid'] = config.uid
        config.football_today_detail_request['ecid'] = lid
        # 获取今日初盘返回的xml响应 xml格式
        response = requests.post(config.url, headers=config.headers, cookies=config.cookies, params=config.params, data=config.football_today_detail_request)
        # 解析单场球赛所有数据
        print(f'response: {response.text}')
        print(f'>>> {lid}')


if __name__ == '__main__':    
    hg = HG()
    is_uid = hg.get_login_uid(None)
    print(f" >>> uid: {is_uid}")
    if is_uid is not None:
        print("===================================================================")
        # 获取皇冠今天的所有比赛id
        today_lid = get_football_today_detail('9491481')